home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 007 / wait1.cq / wait1.c
Encoding:
C/C++ Source or Header  |  1986-06-04  |  4.5 KB  |  129 lines

  1. /************************************************************************/
  2. /*                                    */
  3. /*     Are you tired of Waiting for Mr. Goodcarriage return then     */
  4. /*    Strike Any Key back with this example of VT52 cursor control    */
  5. /*    sequences... For further information refer to the VT100 users    */
  6. /*    guide and/or the Hitchhiker's Guide to the BIOS...        */
  7. /*    CONOUT Escape Sequences....page 24                */
  8. /*                                    */
  9. /************************************************************************/
  10.  
  11. /************************************************************************/
  12. /************************************************************************/
  13. /*                VT52.H                    */
  14. /*             VT52 Escape Sequences                 */
  15. /************************************************************************/
  16. /************************************************************************/
  17.  
  18. #define UP_CURSOR    "\033A"    /* Cursor Up        <ESC>A        */
  19. #define DWN_CURSOR    "\033B"    /* Cursor Down        <ESC>B        */
  20. #define FWD_CURSOR    "\033C"    /* Cursor Forward   <ESC>C        */
  21. #define BKW_CURSOR    "\033D"    /* Cursor Backward  <ESC>D        */
  22. #define CLR_SRCEEN    "\033E"    /* Clear Screen and Home Cursor    <ESC>E    */
  23. #define HOM_CURSOR    "\033H"    /* Home Cursor        <ESC>H        */
  24. #define REV_INDEX    "\033I"    /* Reverse Index    <ESC>I        */
  25. #define ERA_EPAGE    "\033J"    /*                <ESC>J    */
  26. /*     Erase from Cursor position to end of Page             */
  27. #define CLR_EOL        "\033K"    /* Clear to End of Line        <ESC>K    */
  28. #define INS_LINE    "\033L"    /* Insert Line        <ESC>L        */
  29. #define DEL_LINE    "\033M"    /* Delete Line        <ESC>M        */
  30. #define POS_CURSOR    "\033Y"    /* Position Cursor  Row/Column        */
  31. /*                <ESC>Y P1;P2 (P1=\040+ROW  P2=\040+COL) */
  32. #define FOR_COLOR    "\033b"    /* Set Forground Color             */
  33. /*                <ESC>b P1  (P1=\020+COLOR)        */
  34. #define BAK_COLOR    "\033c"    /* Set Background Color         */
  35. /*                    <ESC>c P1  (P1=\020+COLOR)         */
  36. #define ERA_BPAGE    "\033d"    /*                     <ESC>d    */
  37. /*     Erase from Begining of Page to Cursor position            */
  38. #define ENA_CURSOR    "\033e"    /* Enable Cursor            <ESC>e    */
  39. #define DIS_CURSOR    "\033f"    /* Disable Cursor           <ESC>f    */
  40. #define SAV_CURSOR    "\033j"    /* Save Cursor Position        <ESC>j    */
  41. #define RST_CURSOR    "\033k"    /* Restore Cursor Position  <ESC>k    */
  42. #define ERA_ELINE    "\033l"    /* Erase Entire Line        <ESC>l    */
  43. #define ERA_BLINE    "\033o"    /* Erase Begining of Line   <ESC>o    */
  44. #define ON_IVIDEO    "\033p"    /* Enter Reverse Video Mode <ESC>p    */
  45. #define OFF_IVIDEO    "\033q"    /* Exit Reverse Video Mode  <ESC>q    */
  46. #define WRAP_EOL    "\033v"    /* Wrap at End of Line        <ESC>v    */
  47. #define DIS_EOL        "\033w"    /* Discard at End of Line   <ESC>w    */
  48. #define BELL        "\007"    /* Ring Bell                ^G        */
  49.  
  50.  
  51. /************************************************************************/
  52. /************************************************************************/
  53. /*                 COLORS.H                     */
  54. /************************************************************************/
  55. /************************************************************************/
  56.  
  57. #define WHITE    0
  58. #define BLACK    1
  59. #define RED      2
  60. #define GREEN    3
  61. #define BLUE     4
  62. #define CYAN     5
  63. #define YELLOW   6
  64. #define MAGENTA  7
  65. #define LWHITE   8
  66. #define LBLACK   9
  67. #define LRED     10
  68. #define LGREEN   11
  69. #define LBLUE    12
  70. #define LCYAN    13
  71. #define LYELLOW  14
  72. #define LMAGENTA 15
  73.  
  74.  
  75. /************************************************************************/
  76. /************************************************************************/
  77. /*                 WAIT.C                    */
  78. /************************************************************************/
  79. /************************************************************************/
  80.  
  81. #include <osbind.h>
  82.  
  83. #define P_BOT_CURSOR    "\033\131\070\040"    /* <ESC>Y Set Cursor Pos    */
  84. #define void /**/                /* at Bottom of Screen      */
  85.  
  86.  
  87. char MSG0[] = "<<<<<<<<<<<<<<<<<<<<<<<<<<< ";
  88. char MSG1[] = "STRIKE ANY KEY TO CONTINUE";
  89. char MSG2[] = " >>>>>>>>>>>>>>>>>>>>>>>>>>>";
  90.  
  91. main()
  92. {
  93. int i, j;
  94. j = 0;
  95.  
  96.     display(BELL);
  97.     display(DIS_CURSOR);
  98.     while (!Bconstat(2))        /* Wait for Keyboard entry */
  99.     {
  100.         for(i = 0; i <= 20000; ++i);
  101.          ++j;
  102.          display(P_BOT_CURSOR);
  103.         display(MSG0);
  104.         display(ON_IVIDEO);
  105.         display(MSG1);
  106.         display(OFF_IVIDEO);
  107.         display(MSG2);
  108.         for(i = 0; i <= 20000; ++i);
  109.          display(P_BOT_CURSOR);
  110.         display(MSG0);
  111.         display(MSG1);
  112.         display(MSG2);
  113.         if(j == 36)        /* Ring BELL every 10 sec */
  114.             {
  115.             display(BELL);
  116.             j = 0;
  117.             }
  118.     }
  119.     display(ENA_CURSOR);
  120.     Pterm0();
  121. }
  122.  
  123. static void display(s)
  124. char    *s;
  125. {
  126.     while (*s) Bconout(2, *s++);
  127. }
  128.